package middleware

import (
	"moft/model"

	"github.com/gin-gonic/gin"
)

func Session() gin.HandlerFunc {
	return func(c *gin.Context) {
		sess := model.NewSession(c.Request)

		c.Set("is_admin", sess.Get("is_admin"))
		c.Set("user_id", sess.Get("user_id"))
		c.Set("user_name", sess.Get("user_name"))
		c.Next()
	}
}
